<?php
//设置编码
header("content-type:text/html;charset=utf-8");
$u=$_GET['name'];
// echo $u;
$p=$_GET['age'];
echo $p;
//连接数据库
$link=mysqli_connect('localhost','root','123','bbb');

//检查数据库是否连接成功
if(mysqli_connect_error($link)){
    die("连接失败:".mysqli_connect_error());
}else{
    echo "ok-数据库连接成功！";
}

// 设置编码
mysqli_set_charset($link,"utf8");
//sql语句
$sql="insert into user3(age,sex) values($u,'$p')";
//执行sql语句
$r=mysqli_query($link,$sql);
if($r){
    echo "<script>location='../pages/02login.html'</script>";
}else{
    echo"注册失败";
}
mysqli_close($link);


?>